package map;

import java.util.HashMap;
import java.util.Map;

public class MapDemo1 {
    public static void main(String[] args) {

        /*Map<String,Integer> map = new HashMap<>();
        map.put("语文",92);
        map.put("数学",95);
        map.put("英语",93);
        map.put("化学",92);

        System.out.println(map);
        Integer source = map.put("语文", 88);
        System.out.println(source);
        System.out.println(map);
        Integer score = map.get("英语");
        System.out.println(score);
        Integer score1 = map.get("体育");
        System.out.println("体育"+score1);

        int size = map.size();
        System.out.println(size);
        Integer score2 = map.remove("化学");
        System.out.println(score2);
        System.out.println(map);
        System.out.println(map.isEmpty());
        map.put(null,null);
        System.out.println(map);

        boolean b = map.containsKey("体育");
        System.out.println("b"+b);
        boolean b1 = map.containsValue(88);
        System.out.println(b1);
        System.out.println(map.containsKey(null));
        map.clear();
        System.out.println(map);
*/
        Map<String,Integer> map = new HashMap<>();
        map.put("语文",91);
        map.put("数学",95);
        map.put("英语",96);
        map.put("物理",88);
        map.put("化学",91);
        System.out.println(map);
        Integer score1 = map.put("语文", 92);
        System.out.println(score1);
        System.out.println(map);
        System.out.println("map集合元素个数："+map.size());
        System.out.println("map集合是否为空："+map.isEmpty());
        System.out.println("map集合是否包含某键:"+map.containsKey("体育"));
        System.out.println("map集合是否包含某值:"+map.containsValue(88));
        Integer i = map.remove("化学");
        System.out.println("i:"+i);
        System.out.println(map);
        map.clear();
        System.out.println(map);
        System.out.println(map.isEmpty());
        System.out.println(map.size());


    }
}
